/******************************************************************************

    Copyright (C) 2006 Alessio Stalla (alessiostalla@gmail.com)

    This file is part of PrettyProlog.

    PrettyProlog is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    PrettyProlog is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with PrettyProlog; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    See the file COPYING for further details.

 *****************************************************************************/

package prettyprolog.engine.syspreds;

import prettyprolog.datatypes.Substitution;

/**
 * This is the class of the return value of SystemPredicate.call(). It holds
 * information used by the engine to continue solving after a syspred call, i.e.
 * a flag indicating if the syspred failed or not, and a Substitution produced
 * by the syspred.
 */
public class SyspredEffect {

	private boolean fail;
	private Substitution subst;

	public SyspredEffect(boolean ff, Substitution s) {
		fail = ff;
		subst = s;
	}

	/**
	 * @return the flag that controls bactracking. If it's true, the engine will
	 *         backtrack after the syspred call.
	 */
	public boolean getFailFlag() {
		return fail;
	}

	/** Sets the Fail flag, which controls backtracking. */
	protected void setFailFlag(boolean b) {
		fail = b;
	}

	/**
	 * @return the Substitution that the engine will apply to subsequent goals.
	 */
	public Substitution getSubstitution() {
		return subst;
	}

	/** Sets the Substitution. */
	protected void setSubstitution(Substitution s) {
		subst = s;
	}
}